<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>The HTML Presentation Framework</title>
	<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
	<meta name="author" content="Hakim El Hattab">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<style>
		html,body{
			width: 100%;
			height: 100%;
			background:#0A0F23;
		}
		*{
			margin: 0;
			padding: 0;
		}
	</style>
</head>

<body>
<div id="main" style="width: 100%;height:100%;"></div>
<script src="../../components/echarts-4.0.4.min.js"></script>
<script>
    var pieChart = echarts.init(document.getElementById('main'));
    var pieTitle = '2017年西安市各类技术合同成交额';
    var	data=[
        {value:280.35, name:'技术开发'},
        {value:17.13, name:'技术转让'},
        {value:10.77, name:'技术咨询'},
        {value:540.14, name:'技术服务'}
    ];
    var legendData = ['技术服务', '技术开发', '技术转让', '技术咨询'];
    var pieOption = {
        title: {
            text:pieTitle,
            left: 'center',
            top: "15%",
            textStyle: {
                color: '#fff',
                fontSize: 22
            }
        },
        color: ['#0179c4','#0097db','#00a3ac','#029f85','#009f5c','#81bd41','#f44a4a','#ed5f05', '#f29806', '#fdc901','#fdf100','#c0d528'],
        legend: {
            left: '10%',
            top: '25%',
            orient: 'vertical',
            itemGap: 12,
            itemWidth: 10,
            itemHeight: 10,
            icon: 'rect',
            data: legendData,
            textStyle: {
                color: '#fff',
                fontSize: 16
            }
        },
        series: [{
            type: 'pie',
            clockwise: false,
            minAngle: 5,
            radius: '50%',
            center: ['50%', '60%'],
            avoidLabelOverlap: true,
            itemStyle: {
                normal: {
                    borderColor: '#fff',
                    borderWidth: 1
                }
            },
            label: {
                normal: {
                    show: true,
                    position: 'inside',
                    formatter: "{d}%",
                    textStyle: {
                        color: '#fff'
                    }
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontWeight: 'bold'
                    }
                }
            },
            data: data
        }]
    };

    var currentIndex = -1;
    var timer1 = setInterval(function () {
        var dataLen = pieOption.series[0].data.length;
        // 取消之前高亮的图形
        pieChart.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: currentIndex
        });
        currentIndex = (currentIndex + 1) % dataLen;
        // 高亮当前图形
        pieChart.dispatchAction({
            type: 'highlight',
            seriesIndex: 0,
            dataIndex: currentIndex
        });
    }, 1000);
    pieChart.setOption(pieOption);
</script>
</body>
</html>
